﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.IO;
using Agenda.Repositories;

namespace Agenda
{
    public partial class Home : Form
    {
        public Home()
        {
            InitializeComponent();
            DataBaseManagment();
        }

        private static void DataBaseManagment()
        {
            DataConnection.DBConn = Credentials.primaryRoot + "Agendadb.mdb";
            if (!File.Exists(DataConnection.DBConn))
            {
                ConfigurationRepository cr = new ConfigurationRepository();
                cr.CreateDatabase();
                cr.CreateTables();
            }
        }

        private void agregarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Agenda.Forms.Agregar a = new Agenda.Forms.Agregar();
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }

        private void cerrarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void agregarObraToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Agenda.Forms.Obras.Agregar a = new Agenda.Forms.Obras.Agregar();
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }
               
    }
}
